import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:vischat/core/controller/auth_service.dart';
import 'package:vischat/generated/route_table.dart';

class AuthMiddleware extends GetMiddleware {
  @override
  RouteSettings? redirect(String? route) {
    // 替换为你的认证检查逻辑
    final loginState = Get.find<AuthService>().loginState; // 示例：从服务获取登录状态
    return loginState == LoginState.loggedIn
        ? null
        : RouteSettings(name: RouteTable.LOGIN);
  }
}
